//--------------------------------------------------------------------------------------
void COCyEntropiaSSPDlg::ComputeMultiSetWithOneCompliance(int n, int k, std::vector<long> multiset)
{
	for (int h=1 ; h<= n ; h++)
	{
		int j = n-k-h;
		
		long sumatoria1 = 0;
		for (int i=1; i<=k-1 ; i++)
		{
			long Gi = Gauss(i);
			long kib = Kcci (k, i+j+1);
			sumatoria1 += kib * Gi;
		}

		long term1 = sumatoria1;

		long sumatoria2 = 0;
		int upperBound = (k+j) / k;
		for (int i=1; i<= upperBound ; i++)
		{
			int p = i*k+(j%k);
			long kib = Kcci (k, p);
			sumatoria2 += kib;
		}

		long G = Gauss(k);
		long term2 = G * sumatoria2;

		multiset[h] = A(n,k) + term1 - term2;
	}
}

//------------------------------------------------------------------------------------------
// Termino base usado en la recursion y definido de manera que S(1) sea 1
long COCyEntropiaSSPDlg::A(int n, int k)
{
	// j = n-k-1;
	
	long sumatoria1 = 0;
	for (int i=1; i<=k-1 ; i++)
	{
		long kib = Kcci (k, i+n-k);
		long G = Gauss(i);
		sumatoria1 += kib * G;
	}

	long term1 = sumatoria1;

	long sumatoria2 = 0;
	int upperBound = (n-1) / k;
	for (int i=1; i<= upperBound ; i++)
	{
		int p = i*k+ ((n-k-1)%k);
		long kib = Kcci (k, p);
		sumatoria2 += kib;
	}

	long G = Gauss(k);
	long term2 =  G * sumatoria2;

	// despejo 1 = A(n,k) + term1 - term2; 
	long res = 1 + term2 - term1;

	return res;
}
